//
//  ZYLBannerModel.m
//  Cartoon
//
//  Created by dllo on 15/7/16.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ZYLBannerModel.h"
#import "AFNetworkHandler.h"
@implementation ZYLBannerModel
- (void)dealloc
{
    [_type release];
    [_pic release];
    [_value release];
    [super dealloc];
}

- (instancetype)initWithDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}


- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}
- (id)valueForUndefinedKey:(NSString *)key
{
    return nil;
}
+ (void)resultWithURLBlock:(void (^)(NSMutableArray *))block
{
    [AFNetworkHandler GETwithAFNByURL:@"http://api.kuaikanmanhua.com/v1/banners" completion:^(id result) {
        NSArray *temp = result[@"data"][@"banner_group"];
        NSMutableArray *arr = [NSMutableArray array];
        for (NSDictionary *dic in temp) {
            ZYLBannerModel *model = [[ZYLBannerModel alloc] initWithDic:dic];
            [arr addObject:model];
            [model release];
        }
        block(arr);
    }];
}
@end
